/*
 * @Descripttion: 
 * @version: 
 * @Author: mmzhang
 * @Date: 2021-07-27 16:02:34
 * @LastEditTime: 2021-09-24 10:08:09
 */
let vm = null;

const sendThis = (_this) => {
  vm = _this;
};
export default {
  sendThis,
  columns: [{
    type: 'selection',
    width: 60,
    align: 'center',
  },
  {
    title: '全选',
    type: 'index',
    minWidth: 100,
  },
  {
    title: '房号',
    key: 'roomCode',
    minWidth: 120,
  },
  {
    title: '楼栋',
    key: 'buildingName',
    minWidth: 120,
  },
  {
    title: '单元/门牌',
    key: 'unitName',
    minWidth: 120,
  },
  {
    title: '户型',
    key: 'roomType',
    minWidth: 120,
  },
  {
    title: '面积(㎡)',
    key: 'area',
    minWidth: 120,
  },
  {
    title: '表单价(元)',
    key: 'facePrice',
    minWidth: 120,
  },
  {
    title: '表总价(元)',
    key: 'faceTotalPrice',
    minWidth: 120,
  },
  {
    title: '底单价(元)',
    key: 'basicPrice',
    minWidth: 120,
  },
  {
    title: '底总价(元)',
    key: 'basicTotalPrice',
    minWidth: 120,
  },
  {
    title: '售卖状态',
    key: 'sellStatus',
    minWidth: 100,
    render: (h, params) => {
      // 销售状态(1:待售 2:在售 3:售罄)
      let sellStatusName = vm.$formatter.switchName(
        'salesStatus',
        params.row.sellStatus
      )
      return h('span', sellStatusName)
    },
  },
  {
    title: '建筑类型',
    key: 'buildingType',
    minWidth: 120,
  },
  {
    title: '操作',
    key: 'operation',
    minWidth: 160,
    align: 'center',
    fixed: 'right',
    render: (h, params) => {
      return h('div', [
        h(
          'a', {
            style: {
              color: vm.unlocking('0103040700') ? '#19BE6B' : '#c5c8ce',
              cursor: vm.unlocking('0103040700') ?
                'pointer' : 'not-allowed',
            },
            on: {
              click: (e) => {
                e.stopPropagation()
                vm.editRoom = []
                vm.unlocking('0103040700') &&
                  vm.editRoom.push(params.row)
                vm.editRoomFlag = vm.unlocking('0103040700') ?
                  true :
                  false
              },
            },
          },
          '编辑'
        ),
        h(
          'a', {
            style: {
              marginLeft: '10px',
              color: vm.unlocking('0103040800') ? '#19BE6B' : '#c5c8ce',
              cursor: vm.unlocking('0103040800') ?
                'pointer' : 'not-allowed',
              display: params.row.sellStatus == 3 ? 'none' : 'inline-block',
            },
            on: {
              click: (e) => {
                e.stopPropagation()
                vm.unlocking('0103040800') &&
                  vm.deleteRoomFun(params.row)
              },
            },
          },
          '删除'
        ),
      ])
    },
  }, ],
}